unit uOfLibera;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FMTBcd, DB, DBClient, Provider, SqlExpr, Grids, DBGrids,
  JvExDBGrids, JvDBGrid, StdCtrls, Buttons, Mask, JvExMask, JvToolEdit,
  ExtCtrls, MMJPanel;

type
  TfOfLibera = class(TForm)
    MMJPanel1: TMMJPanel;
    Label1: TLabel;
    Label4: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Dta1: TJvDateEdit;
    edProd: TEdit;
    BitBtn6: TBitBtn;
    Dta2: TJvDateEdit;
    edOf: TEdit;
    en: TBitBtn;
    BitBtn4: TBitBtn;
    gridComp: TJvDBGrid;
    gridProd: TJvDBGrid;
    sqlDetOf: TSQLDataSet;
    sqlDetOfDOF_CODIGO: TFMTBCDField;
    sqlDetOfDOF_CODIOF: TStringField;
    sqlDetOfDOF_QTDPRG: TStringField;
    dspDetOf: TDataSetProvider;
    cdsDetOf: TClientDataSet;
    cdsDetOfDOF_CODIGO: TFMTBCDField;
    cdsDetOfDOF_CODIOF: TStringField;
    cdsDetOfDOF_QTDPRG: TStringField;
    dsDetOf: TDataSource;
    rgOf: TRadioGroup;
    procedure FormShow(Sender: TObject);
    procedure rgOfClick(Sender: TObject);
  private
    procedure abreGridDet(Status: SmallInt);
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fOfLibera: TfOfLibera;

implementation

uses udm;

{$R *.dfm}

{ TfOfLibera }

procedure TfOfLibera.abreGridDet(Status: Smallint);
var str: string;
begin
  str := 'Select * from ATS_DETOF WHERE DOF_STATUS = ';
  str := str + IntToStr(status);
  if (cdsDetOf.Active) then
    cdsDetOf.Close;
  cdsDetOf.CommandText := str;
  cdsDetOf.Open;  
end;

procedure TfOfLibera.FormShow(Sender: TObject);
begin
  abreGridDet(0);
end;

procedure TfOfLibera.rgOfClick(Sender: TObject);
begin
  abreGridDet(rgOf.ItemIndex);
end;

end.
